package com.honeywell.iotserver.repository;

import java.util.Date;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.honeywell.iotserver.entity.HeartBeatEntity;

@Repository
public interface DeviceAlarmScheduleRepository extends JpaRepository<HeartBeatEntity, String> {
	@Modifying
	@Transactional
	@Query(value = "select NOW(),th.uuid,th.heartp_time from t_heartbeat as th,t_camera as tc where tc.uuid=th.uuid and tc.status=1", nativeQuery = true)
	public List<Object> seletemaxdate();
	
	
	@Modifying
	@Transactional
	@Query(value = "update t_camera set status=0 where uuid in ?1  ",nativeQuery = true)
	public Integer updatestatus(List<String> uuidlist);
	
//	@Modifying
//	@Transactional
//	@Query(value = "insert into t_on_off_log(uuid,on_off_status,on_off_time) values (?1,?2,NOW())", nativeQuery = true)
//	public void insertonoffdate(String uuid,Integer status);
	
}
